<?php 

/***
 * 资源页面 通常就是账号以及接口信息
 */
// include our OAuth2 Server object
require_once __DIR__.'/server.php';
 
// Handle a request for an OAuth2.0 Access Token and send the response to the client
if (!$server->verifyResourceRequest(OAuth2\Request::createFromGlobals())) {//验证token
    $server->getResponse()->send();

    echo json_encode(array('status' => -1, 'msg' => 'token error','data'=>array()));
}else{//验证成功
    $token = $server->getAccessTokenData(OAuth2\Request::createFromGlobals());
    $data = array(
        'status' => 0,
        'msg' => 'msg',
        'data'=>array(
            'user_id'=>$token['user_id']
        )
    );
	echo json_encode($data);
    //todo 调用用户信息等

}
